﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace PJOnimal
{
    public class Input
    {
        public KeyboardState trangThaiCu, trangThaiMoi;
        public MouseState chuotCu, chuotMoi;

        public Rectangle conChuot;

        public void Update(GameTime gameTime)
        {
            conChuot = new Rectangle(chuotMoi.X, chuotMoi.Y, 1, 1);

            chuotCu = chuotMoi;
            chuotMoi = Mouse.GetState();  

            trangThaiCu = trangThaiMoi;
            trangThaiMoi = Keyboard.GetState();

        }

        public bool NhanChuot()
        {
            return (chuotMoi.LeftButton == ButtonState.Pressed
                && chuotCu.LeftButton == ButtonState.Released);
        }

        public bool NhanNut(Keys nut)
        {
            return (trangThaiMoi.IsKeyDown(nut) && trangThaiCu.IsKeyUp(nut));
        }

        public bool NhanNut1(Keys nut)
        {
            return (trangThaiMoi.IsKeyDown(nut));
        }
    }
}
